import request from "./useRequests";
import { userinfo } from '@/stores/counter'
import { ElMessage } from 'element-plus'

export default function getArticleList() {
  const user = userinfo()
  async function allList() {
    try {
      const res = await request({
        method: "get",
        url: `/article/newest`,
        params: {
          "page": user.pages.home.page,
          "size": 3,
        }
      })
      user.pages.home.total = res.data.data.total
      user.pages.home.list.push(...res.data.data.items)
    } catch (err: any) {
      //alert(err)
    }
  }
  return {
    allList
  }
}